package personresources.manager.logic.impl;

import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import personresources.manager.dao.GroupDao;
import personresources.manager.hibernate.Group;
import personresources.manager.logic.GroupLogic;
@Service("groupLogic")
public class GroupLogicImpl implements GroupLogic {

	@Autowired
	private GroupDao groupDao;
	public List<Group> getGroupList() {
		
		return groupDao.getGroups();
	}

	public List<SelectItem> getGroupSelectItemList() {
		List<SelectItem> groupSelectItemList = new ArrayList<SelectItem>();
		List<Group> groupList = this.getGroupList();
		for(Group group : groupList) {
			SelectItem sl = new SelectItem(group.getGroupId(), group.getGroupName());
			groupSelectItemList.add(sl);
		}
		return groupSelectItemList;
	}
	

}
